package com.tuling.netty.splitpacket;

import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

import java.net.SocketAddress;
import java.nio.charset.StandardCharsets;

public class SplitPacketServerHandler extends SimpleChannelInboundHandler <MyMessagePropol>{


    @Override
    protected void channelRead0(ChannelHandlerContext ctx, MyMessagePropol msg) throws Exception {
        //服务端接受到客户端的请求
        System.out.println("接收到客户端的请求地址是"+new String(msg.getContent(), StandardCharsets.UTF_8));
        Channel channel = ctx.channel();
        SocketAddress socketAddress = channel.remoteAddress();
        System.out.println("接收到客户端的请求地址是"+socketAddress);
    }
}
